package bb.lanxing.model.database;

import android.os.Parcel;
import android.os.Parcelable;
//import com.orm.SugarRecord;
//import com.orm.dsl.Table;
//import com.orm.query.Select;
import bb.lanxing.util.JsonUtil;
import org.json.JSONObject;
import org.litepal.LitePal;
import org.litepal.crud.LitePalSupport;


public class Perms extends LitePalTableBase implements Parcelable {
    public static final Parcelable.Creator<Perms> CREATOR = new Parcelable.Creator<Perms>() {
        @Override
        public Perms createFromParcel(Parcel parcel) {
            return new Perms(parcel);
        }

        @Override
        public Perms[] newArray(int i) {
            return new Perms[i];
        }
    };
    private int avatar;
    private int licenseNumberSkin;
    private int mapSkin;
    private int pannelObject2;
    private int pannelObject5;
    private int segmentConstrast;
    private int sharePage;
    private int workoutMapHidden;
    private int workoutMerge;

    @Override
    public int describeContents() {
        return 0;
    }

    public Perms() {
    }

    public Perms(JSONObject jSONObject) {
        setWorkoutMerge(JsonUtil.getIntegerValue("workout_merge", jSONObject));
        setWorkoutMapHidden(JsonUtil.getIntegerValue("workout_map_hidden", jSONObject));
        setSegmentConstrast(JsonUtil.getIntegerValue("segment_constrast", jSONObject));
        setPannelObject2(JsonUtil.getIntegerValue("pannel_object_2", jSONObject));
        setPannelObject5(JsonUtil.getIntegerValue("pannel_object_5", jSONObject));
        setSharePage(JsonUtil.getIntegerValue("share_page", jSONObject));
        setMapSkin(JsonUtil.getIntegerValue("map_skin", jSONObject));
        setLicenseNumberSkin(JsonUtil.getIntegerValue("license_number_skin", jSONObject));
        setAvatar(JsonUtil.getIntegerValue("avatar", jSONObject));
    }

    public static Perms getById(long j) {
        String id = String.valueOf(j);
        Perms p = LitePal.where("baseObjId=?", id).findFirst(Perms.class);
        return p;


    }

    protected Perms(Parcel parcel) {
        this.workoutMerge = parcel.readInt();
        this.workoutMapHidden = parcel.readInt();
        this.segmentConstrast = parcel.readInt();
        this.pannelObject2 = parcel.readInt();
        this.pannelObject5 = parcel.readInt();
        this.sharePage = parcel.readInt();
        this.mapSkin = parcel.readInt();
        this.licenseNumberSkin = parcel.readInt();
        this.avatar = parcel.readInt();
    }

    @Override
    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeInt(this.workoutMerge);
        parcel.writeInt(this.workoutMapHidden);
        parcel.writeInt(this.segmentConstrast);
        parcel.writeInt(this.pannelObject2);
        parcel.writeInt(this.pannelObject5);
        parcel.writeInt(this.sharePage);
        parcel.writeInt(this.mapSkin);
        parcel.writeInt(this.licenseNumberSkin);
        parcel.writeInt(this.avatar);
    }

    public int getWorkoutMerge() {
        return this.workoutMerge;
    }

    public void setWorkoutMerge(int i) {
        this.workoutMerge = i;
    }

    public int getWorkoutMapHidden() {
        return this.workoutMapHidden;
    }

    public void setWorkoutMapHidden(int i) {
        this.workoutMapHidden = i;
    }

    public int getSegmentConstrast() {
        return this.segmentConstrast;
    }

    public void setSegmentConstrast(int i) {
        this.segmentConstrast = i;
    }

    public int getPannelObject2() {
        return this.pannelObject2;
    }

    public void setPannelObject2(int i) {
        this.pannelObject2 = i;
    }

    public int getPannelObject5() {
        return this.pannelObject5;
    }

    public void setPannelObject5(int i) {
        this.pannelObject5 = i;
    }

    public int getSharePage() {
        return this.sharePage;
    }

    public void setSharePage(int i) {
        this.sharePage = i;
    }

    public int getMapSkin() {
        return this.mapSkin;
    }

    public void setMapSkin(int i) {
        this.mapSkin = i;
    }

    public int getLicenseNumberSkin() {
        return this.licenseNumberSkin;
    }

    public void setLicenseNumberSkin(int i) {
        this.licenseNumberSkin = i;
    }

    public int getAvatar() {
        return this.avatar;
    }

    public void setAvatar(int i) {
        this.avatar = i;
    }
}
